using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class SurveySessionMap : EntityTypeConfiguration<SurveySession>
    {
        public SurveySessionMap()
        {
            // Primary Key
            this.HasKey(t => t.Session_id);

            // Properties
            this.Property(t => t.Country)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.City)
                .HasMaxLength(50);

            this.Property(t => t.CourseLevel)
                .HasMaxLength(50);

            this.Property(t => t.ProductCode)
                .HasMaxLength(10);

            this.Property(t => t.Language)
                .IsRequired()
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("SurveySession");
            this.Property(t => t.Session_id).HasColumnName("Session_id");
            this.Property(t => t.ContactUs_id).HasColumnName("ContactUs_id");
            this.Property(t => t.Survey_id).HasColumnName("Survey_id");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.City).HasColumnName("City");
            this.Property(t => t.CourseLevel).HasColumnName("CourseLevel");
            this.Property(t => t.ProductCode).HasColumnName("ProductCode");
            this.Property(t => t.Language).HasColumnName("Language");
            this.Property(t => t.UserQuitMode).HasColumnName("UserQuitMode");
            this.Property(t => t.InsertDate).HasColumnName("InsertDate");
        }
    }
}
